<?
include "server_config.php";
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <title> 넥도닥 [NextDoorDoctor] :: 데이터베이스 </title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<link rel="stylesheet" type="text/css" href="css/common.css">
	<script type="text/javascript" src="./js/jquery-1.6.2.min.js"></script>
	<script>
		var current_menu = 1;
		<? include 'js/common.js';?>
	</script>
 </head>

 <body >
  <table border=0 width='980px' align='center'>
	

<?
include "nddg_top_menu.php";
?>	

	<tr>
		<td>
			<div style='width:594px;padding:25px;border:1px solid #D6D6D6; float:left;'>
				<font size='3' color='#23B574'><b>갑상선 암, 무엇을 알아야 할까요?</b></font><br>
				<br>
				<br>
					<?
						$sql="
							SELECT id, name, count FROM nddg_question_category  ORDER BY id ;
						";

						$result = mysql_query($sql,$connect);

						while($row = mysql_fetch_row($result))
						{
					?>
							<div style='width:100%;height:35px;float:left;'>
							<a href='nddg_db_category.php?category=<?=$row[0]?>'>
								<div class='db_category_link'>
									<font size=5><?=$row[1]?></font>
								
								</div>
								<!--div style='width:530px;padding-left:10px;padding-top:5px;height:30px;line-height:25px;'></div-->
							</a>
							</div>
							<div style='width:100%;height:1px;float:left;margin-top:6px;margin-bottom:6px; 
								border-bottom:2px dotted #E4E3DE;'><span></span></div>
					<?
						}
					?>
							<div style='width:100%;height:35px;float:left;'>
							<a href='nddg_db_category.php?category=11'>
								<div class='db_category_link'>
									<font size=5>... 그 외의 질문들</font>
								
								</div>
								<!--div style='width:530px;padding-left:10px;padding-top:5px;height:30px;line-height:25px;'></div-->
							</a>
							</div>
			</div>
			
			<div style='width:250px;padding-left:25px;padding-right:25px;padding-bottom:25px; margin-left:30px;border:1px solid #D6D6D6; float:left;
				background:#F9F9F1; border:1px solid #E4E3DE;'>
				<img src='img/title_db_right.png' border=0><br>
				<br>
				<?
					$sql_sub="
						SELECT id, content, view_count, answer_count FROM nddg_question ORDER BY reg_timestamp LIMIT 10;
					";

					$result_sub = mysql_query($sql_sub,$connect);

					while($row_sub = mysql_fetch_row($result_sub))
					{

				?>
				<a href='nddg_db_category.php?question=<?=$row_sub[0]?>'><?=$row_sub[1]?></a><br>
					<?
					}
				?>
			</div>

			<div style='width:594px;padding:25px;padding-top:0px;margin-top:15px;
				border:1px solid #D6D6D6; float:left;
				border-bottom:2px dotted #E4E3DE;
				'>
				<img src='img/title_db_search.png' border=0><br>
				<br>
				<input type='text' style='width:510px;height:46px;font-size:20px;line-height:45px;border:1px solid #23B574; color:#23B574; float:left;'>
				<img src='img/button_search.png' border=0 style='cursor:pointer;'><br>
				<br>
				<b>떠오르는 모든 질문</b>을 입력하면 <b>관련된 답변</b>이 아래에 제공됩니다.<br>
			</div>
			<div style='width:594px;padding:25px;padding-top:0px;margin-bottom:15px;
				background:#F9F9F1;
				border:1px solid #D6D6D6; float:left;
				border-top:0px;
				'>
			</div>
			<!--div style='width:270px;float:left;'>
				[자주묻는 질문]<br><br>
				<?
					$sql_sub="
						SELECT id, content, view_count, answer_count FROM nddg_question ORDER BY reg_timestamp LIMIT 5;
					";

					$result_sub = mysql_query($sql_sub,$connect);

					while($row_sub = mysql_fetch_row($result_sub))
					{

				?>
					<a href='nddg_db_category.php?question=<?=$row_sub[0]?>'><?=$row_sub[1]?></a><br>
					<?
					}
				?>
				<br>
				<br>
				[갑상선 암이란?]<br><br>
				1.	갑상선의 기능<br>
				2.	갑상선 암의 종류<br>
				3.	갑상선 암의 치료 과정<br>
				
			</div>
			<div style='width:30px;float:left;height:50px;'>
			</div>
			<div style='width:700px;float:left;'>
				<div  style='width:300px;float:left; text-align:center;'>
					<?
						$sql="
							SELECT id, name, count FROM nddg_question_category WHERE id<5 ORDER BY id ;
						";

						$result = mysql_query($sql,$connect);

						while($row = mysql_fetch_row($result))
						{
					?>
							<a href='nddg_db_category.php?category=<?=$row[0]?>'><b>[ <?=$row[1]?> ]</b></a><br>

							<?
								$sql_sub="
									SELECT id, content, view_count, answer_count FROM nddg_question WHERE category_id=".$row[0]." ORDER BY view_count DESC LIMIT 5 ;
								";

								$result_sub = mysql_query($sql_sub,$connect);

								while($row_sub = mysql_fetch_row($result_sub))
								{

							?>
								<a href='nddg_db_category.php?question=<?=$row_sub[0]?>'><?=$row_sub[1]?></a><br>
							<?
								}
							?>

							<br>

					<?
						}
					?>
				</div>
				<div  style='width:100px;height:300px;float:left; text-align:center;'>
					<br>
					<br>
					<br>
					<br>
					<br>
					<br>
					갑상선암!<br>
					무엇을 알아야<br>
					할까요?
				</div>
				<div  style='width:300px;float:left; text-align:center;'>
					<?
						$sql="
							SELECT id, name, count FROM nddg_question_category WHERE id>=5 ORDER BY id ;
						";

						$result = mysql_query($sql,$connect);

						while($row = mysql_fetch_row($result))
						{
					?>
							<a href='nddg_db_category.php?category=<?=$row[0]?>'><b>[ <?=$row[1]?> ]</b></a><br>

							<?
								$sql_sub="
									SELECT id, content, view_count, answer_count FROM nddg_question WHERE category_id=".$row[0]." ORDER BY view_count DESC LIMIT 5 ;
								";

								$result_sub = mysql_query($sql_sub,$connect);

								while($row_sub = mysql_fetch_row($result_sub))
								{

							?>
								<a href='nddg_db_category.php?question=<?=$row_sub[0]?>'><?=$row_sub[1]?></a><br>
							<?
								}
							?>

							<br>

					<?
						}
					?>
				</div>
				

				<div style='width:700px;height:30px;float:left;'>
				</div>
				<div style='width:700px;height:20px;float:left;background:#eee;'>
				</div>
				<div style='width:700px;float:left; text-align:center;background:#eee;' id='search_box'>
					무엇이 궁금하세요? <input type='text' name='input_question'> <input type='button' value='검색'><br>
					<br>
					떠오르는 단어를 입력하시면 관련 질문들이 아래에 제공됩니다.<br>
				</div>
				<div style='width:660px;padding:20px;float:left;background:#eee;' id='search_result'>
					<?
						$sql_sub="
							SELECT id, content, view_count, answer_count FROM nddg_question ORDER BY view_count DESC LIMIT 5 ;
						";

						$result_sub = mysql_query($sql_sub,$connect);

						while($row_sub = mysql_fetch_row($result_sub))
						{

					?>
					<hr>
						
						<b><?=$row_sub[1]?></b><br>

							<?
								$sql_answer="
									SELECT id, content, user_id FROM nddg_answer WHERE question_id=".$row_sub[0]."  LIMIT 1 ;
								";

								$result_answer = mysql_query($sql_answer,$connect);

								$row_answer = mysql_fetch_row($result_answer);

								echo utf8_strcut($row_answer[1],200);							

							?>
							<br>
							<a href='nddg_db_category.php?question=<?=$row_sub[0]?>'>
								- 전체보기 (3개의 답이 더 있습니다.)
							</a>
						
						<br>
					<?
						}
					?>
					<br>

				</div>


			</div-->



			
		</td>
	</tr>

<?
include "nddg_footer.php";
?>	

  </table>
 </body>
</html>
